package jmvcclab.View;
import jmvcclab.Model.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class CalcForm extends JFrame {
    private MainData mainData;
    private JPanel contentPanel;
    private IOPanel textAndGO;
    private NumPanel numbers;
    private OpsPanel operations;


    public CalcForm(MainData mainData) {
        //Create the frame
        super("Enjoy our calculator!");
        this.mainData = mainData;

        // Create the container.
	contentPanel = new JPanel();
        contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS));

        // Add the widgets.
        textAndGO = new IOPanel(mainData);
        contentPanel.add(textAndGO);

        numbers = new NumPanel(textAndGO);
        operations = new OpsPanel(textAndGO);

        JPanel all = new JPanel();
        all.setLayout(new FlowLayout(FlowLayout.LEADING,10,10));
        all.add(numbers);
        all.add(operations);
        contentPanel.add(all);

	// Add the panel to the frame.
	this.getContentPane().add(contentPanel, BorderLayout.CENTER);

        // Exit when the window is closed.
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        // Disable resizing
        this.setResizable(false);

	// Show the content
	this.pack();
        this.setLocationRelativeTo(null);
	this.setVisible(true);
   }
}
